package com.agent.server;

import com.agent.server.grpc.AgentGrpcServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class AgentServerApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(AgentServerApplication.class, args);
        
        // Get the gRPC server bean
        AgentGrpcServer grpcServer = context.getBean(AgentGrpcServer.class);
        
        // Make sure the application doesn't exit
        try {
            grpcServer.blockUntilShutdown();
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
    }
}
